<!DOCTYPE html>
<html >
<head>
	<meta charset="UTF-8">
	<title>blog</title>
	<?php $this->load->view("admin/header.php");?>
</head>
<body>
	<?php  $this->load->view("admin/nav.php");?>
	<div class="container">
		<div class="page-header">
			<h1>文章<small>列表</small>
				<a href="<?php echo site_url("admin/article/add");?>"><button type="button" class="btn btn-success pull-right">添加</button></a>
			</h1>
		</div>
		<table class="table table-bordered table-condensed" >
			<tr>
				<th>标题</th>
				<th>创建时间</th>
				<th>访问人数</th>
				<th>是否推荐</th>
				<th>操作</th>
			</tr>
			<tr>
				<?php 
					if(empty($articles)){
				?>
				<td class="errors" colspan="9">	
					没有数据
				</td>
				<?php
					}
				?>
			</tr>
		<?php 
			foreach ($articles as $article) {
		?><tr>
			<td><a class="title" href="<?php echo site_url("Article/view/".$article->id) ;?>"><?php echo $article->title;?></a></td>
			<td><?php echo date("Y-m-d H:i:s",$article->create_time); ?></td>
			<td><?php echo $article->view; ?></td>
			<td>
			<?php echo $article->recommend==1?"<button type=\"button\" class=\"btn btn-success\">已推荐</button>":""; ?></td>
			<td>
				<?php if($article->recommend==1){?>
					<a class="btn btn-info" href="<?php echo site_url("admin/Article/recommend/".$article->id.'/0')?>">取消</a>
				<?php }else{ ?>
					<a class="btn btn-primary" href="<?php echo site_url("admin/Article/recommend/".$article->id.'/1')?>">推荐</a>
				<?php };?>
				<a class="btn btn-warning btn-sm" href="<?php echo site_url("admin/article/edit/".$article->id);?>">修改</a>
				<a  class="del" href="<?php echo site_url("admin/Article/del/".$article->id)?>">
				<button  type="button" class="btn btn-danger btn-sm">删除</button></a>
			</td>
			</tr>
			<?php } ?>	
		</table>
		<div class="row">
			<div class="col-md-4 col-md-offset-4">
			<?php echo ($this->pagination->create_links()) ;?>
			</div>
		</div>
	</div>
</body>
</html>